"""
读取car.txt中的数据
将字符串数据，使用标签编码进行数据预处理
"""
from tkinter.font import names

import pandas as pd
import sklearn.preprocessing as sp

data = pd.read_csv('car.txt',header=None)
# print(data)
res_data = pd.DataFrame()

for i in data:
    encoder = sp.LabelEncoder()
    res = encoder.fit_transform(data[i])
    res_data[i] = res

print(res_data)